const http = require('http')
const url = require('url')
const port = 9888
// 连接数据库
const model = require('./model/user_model').userModel
let resdata = null


// 启动WEB 服务
http.createServer((req, res) => {
    res.setHeader("Access-Control-Allow-Origin", "*");
    model.find({
        username: 'mxh'
    }, function (err, data) {
        if (err) {
            resdata = err
        } else {
            resdata = data
        }
        res.end(JSON.stringify(resdata))
    })
}).listen(port)